﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

using Pibby.Core.IO;
using Pibby.Core.Persistence;

namespace Pibby.Core.Models
{
	public interface IPodcatcherModel
	{
		#region Settings

		//event EventHandler SettingsLoaded;
		event EventHandler SettingsChanged;

		IUserSettings Settings
		{
			get;
		}

		#endregion Settings

		#region Import and Export

		void ImportSubscriptions(TextReader reader);

		void ExportSubscriptions(TextWriter writer);

		#endregion Import and Export

		#region Subscriptions

		//[Obsolete("Dont use guid version")]
		//Podcast LoadSubscription(string guid);

		Podcast LoadSubscription(int dbKey);

		PodcastCollection LoadSubscriptions();

		EpisodeCollection LoadEpisodes();

		EpisodeCollection LoadEpisodes(EpisodeLifecycle lifecycle);

		EpisodeCollection LoadEpisodes(Podcast podcast);

		//[Obsolete("Dont use guid version")]
		//DownloadableCollection LoadEpisodesForDownload(IEnumerable<string> guids);

		DownloadableCollection LoadEpisodesForDownload(IEnumerable<int> dbKeys);

		void AddPodcast(Podcast newPodcast);

		void UpdatePodcast(Podcast existingPodcast);

		void RenamePodcast(Podcast existingPodcast, string newName);

		void RemovePodcast(Podcast existingPodcast);

		//[Obsolete("Dont use guid version")]
		//Episode LoadEpisode(string id);

		Episode LoadEpisode(int dbKey);

		void UpdateEpisode(Episode e);

		//[Obsolete("Dont use guid version")]
		//void UpdateEpisodes(IEnumerable<string> ids, EpisodeLifecycle stage);

		void UpdateEpisodes(IEnumerable<int> dbKeys, EpisodeLifecycle stage);

		PodcastCollection SearchPodcasts(string searchTerm);

		[Obsolete("Dont use guid version")]
		EpisodeCollection SearchEpisodes(string podcastGuid, string searchTerm);

		EpisodeCollection SearchEpisodes(string searchTerm);

		void CreateFeed(Uri uri, string suggestedName, string content);

		//[Obsolete("Dont use guid version")]
		//void UpdateFeed(string guid, string content);

		void UpdateFeed(int dbKey, string content);

		DownloadableCollection DownloadableFeeds { get; }

		#endregion Subscriptions

		#region PortableMedia

		event EventHandler<RemovableDriveEventArgs> PortableMediaArrived;

		event EventHandler<RemovableDriveEventArgs> PortableMediaRemoved;

		PortableMediaDevice PortableMedia
		{
			get;
		}

		void CheckPortableMediaStatus();

		void CheckPortableMediaArrived(RemovableDriveEventArgs e);

		void CheckPortableMediaRemoved(RemovableDriveEventArgs e);

		#endregion PortableMedia

		TransferableCollection TransferrableContent { get; }

		void RebaseReputations();

        void ReloadSettings();
	}
}
